<include file="Common/header" />
<title>账单列表</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 账单管理 
	<span class="c-gray en">&gt;</span> 费用催缴 
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="pd-20">
	<div class="codeView docs-example" data-afterContent="按条件查询">
		<div style="padding-left: 20px;padding-right: 20px">
			<span style="display: inline-block;width: 250px;text-align: right">
				房间编号：
				<input class="input-text radius" id="room_number" name="room_number" style="width:150px" />
			</span>

			<span style="display: inline-block;width: 200px;text-align: right">
				账单类型：
				<span class="select-box radius" style="width: 100px">
					<select class="select" size="1" name="order_type" id="order_type">
						<option value="0">全部</option>
						<option value="1">固定</option>
						<option value="2">日常</option>
					</select>
				</span>
			</span>

			<span style="display: inline-block;width: 280px;text-align: right;margin-left: 13px;">
				收费月份：
				<span class="select-box radius" style="width: 100px;">
					<select class="select" size="1" name="qorder_year" id="qorder_year">
						<?php $year = date('Y'); for($i=$year;$i>=($year-5);$i--){ ?>
						<?php if($i == date('Y')){ ?>
						<option value="{$i}" selected="selected">{$i}年</option>
						<?php }else{ ?>
						<option value="{$i}">{$i}年</option>
						<?php } ?>
						<?php } ?>
					</select>
				</span>
				
				<span class="select-box radius" style="width: 100px;">
					<select class="select" size="1" name="qorder_type" id="qorder_type">
						<?php for($i=1;$i<=12;$i++){ ?>
						<?php if($i == date('m')){ ?>
						<option value="{$i}" selected="selected">{$i}月</option>
						<?php }else{ ?>
						<option value="{$i}">{$i}月</option>
						<?php } ?>
						<?php } ?>
					</select>
				</span>
			</span>
			<span style="display: inline-block;width: 280px;text-align: right">
				费用截止时间：
				<span class="select-box radius" style="width:150px">
					<input class="select select form-control layer-date time" id="lastCalltime" name="lastCalltime" />
				</span>
			</span>
			<a href="javascript:;" class="btn btn-success radius querys"><i class="Hui-iconfont">&#xe709;</i> 查询</a> 
		</div>
	</div>

	<div class="cl pd-5 bg-1 bk-gray"> 
		<span class="l">
			<a class="btn btn-danger radius explodes" href="javascript:;"><i class="Hui-iconfont">&#xe644;</i> 导出账单</a>
			<a class="btn btn-secondary radius dbcall" href="javascript:;"><i class="Hui-iconfont">&#xe6e1;</i> 批量催缴</a>
		</span>
	</div>

	<div class="dataTables_wrapper no-footer" id="ajaxDiv">
		<include file="Costlog/call_list" />
	</div>
</div>

<script type="text/javascript">
	$(function(){
		$(".time").on('click', function(){
			laydate({istime: true, format: 'YYYY-MM-DD'});
		});
		
		//按条件查询
		$(".querys").on('click', function(){
			var load = layer.load(2);
			var where = {};
				where.room_number = $("#room_number").val();
				where.order_type = $("#order_type").val();
				where.status = $("#status").val();
				where.qorder_type = $("#qorder_type").val();
				where.qorder_year = $("#qorder_year").val();
				where.lasttime = $("#lastCalltime").val();
				where.ajax = 1;
			$.get('call.html', where, function(data){
				layer.close(load);
				$("#ajaxDiv").html(data);
			});
		});

		//批量催缴
		$(".dbcall").on('click', function(){
			var ids = '';
			$("tr.text-c td input:checkbox").each(function(){
				if($(this).is(":checked")){
					ids += $(this).val()+',';
				}
			});

			if(ids.length <= 0){
				layer.msg('请选择需要审核的账单', {icon: 5, time: 2000});
				return false;
			}
			var load = layer.load(2);
			$.post('allcall.html', {ids: ids}, function(row){
				if(row/1){
					layer.msg('催缴成功', {icon: 1, time: 2000}, function(){
						location.reload();
					});
				}else{
					layer.msg('催缴失败', {icon: 2, time: 2000});
				}
			});
		});

		//导出数据
		$(".explodes").on('click', function(){
			var room_number = $("#room_number").val();
			var order_type = $("#order_type").val();
			var status = 0;
			var qorder_type = $("#qorder_type").val();
			var qorder_year = $("#qorder_year").val();
			var lasttime = $("#lastCalltime").val();

			location.href = 'explodes.html?room_number='+ room_number + '&order_type='+ order_type + '&status='+ status + '&qorder_type'+ qorder_type + '&qorder_year='+ qorder_year + '&lasttime='+ lasttime;
		});
	});
	
	function sendmsg(obj, id){
		$.post('call.html', {costlog_id: id}, function(row){
			if(row/1){
				layer.msg('催缴成功', {icon: 1, time: 2000}, function(){
					location.reload();
				});
			}else{
				layer.msg('催缴失败', {icon: 2, time: 2000});
			}
		});
	}

	/*管理员-角色-添加*/
	function admin_role_add(title,url,w,h){
		layer_show(title,url,w,h);
	}
	
	/*管理员-角色-编辑*/
	function admin_role_edit(title,url,id,w,h){
		layer_show(title,url,w,h);
	}
	
	function admin_role_del(obj,id){
		layer.confirm('确认要删除吗？',function(index){
			$.post('index.html', {tid: id}, function(rs){
				if(rs == '删除成功'){
					$("#tr_"+ id).html('是');
				}

				layer.msg(rs, {icon:1,time: 2000});
			});
		});
	}
</script>
</body>
</html>